<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@include file="/common/tags.jsp" %>
<!DOCTYPE html>
<html>
<head>
  <title></title>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <meta charset="UTF-8">
  <meta name="Keywords" content="">
  <meta name="description" content="">
  <%@include file="/common/style.jsp" %>
  <link rel="stylesheet" type="text/css" href="${static_url}/ui/app/assets/css/uc.css">

  <%@include file="/common/javascript.jsp" %>
  <%@include file="/common/js/niceValidator.jsp"%>

</head>
<body class="wide">
<!-- 头部 -->
<%@include file="/common/myHeader.jsp" %>
<!-- /头部 -->

<!-- 主体 -->
<div style="border-top: solid 1px #dcdcdc;" class="mb10"></div>
<div class="g">
  <!--面包屑 -->
  <%--<div class="breadcrumb-area"><a href="/" title="首页">首页</a>&nbsp;&nbsp;\&nbsp;&nbsp;<em
          id="personCenter"><span>我的商城</span></em><em id="pathPoint"></em><span id="pathTitle"></span></div>--%>
</div>
<div class="h20"></div>
<div class="g">
  <div class="fr u-4-5"><!-- 20141212-栏目-start -->
    <div class="section-header">
      <div class="fl">
        <h2><span>地址管理</span></h2>
      </div>
    </div>
    <div class="h20"></div>
    <div class="myAddress-edit" id="myAddress-edit">
      <div class="form-edit-panels" id="form-edit-panels">
        <form id="address-form" action="${ctx}/my/buyer/address/insert.htm" method="post" data-validator-option="{stopOnError:false, timely:true}">
            <input type="hidden" id="id" name="id" value="">
            <input type="hidden" name="state" value="1">
            <input type="hidden" name="addressStreetId" value="0">
          <div class="form-edit-table">
            <table border="0" cellpadding="0" cellspacing="0">
              <tbody>
              <tr>
                  <th><span class="required">*</span><label for="contactName">收货人：</label></th>
                  <td>
                      <input maxlength="20" type="text" name="contactName" id="contactName"
                             class="text"
                             data-rule="required;length[2~10];"
                             data-msg-required="输入2-10个以字母、数字和下划线组成的用户名"
                             data-ok=""
                             data-target="#contactName-msg">
                      <label id="contactName-msg"></label>
                  </td>
              </tr>
              <tr>
                <td><span class="required">*</span><label>地址：</label></td>
                <td>
                    <jsp:include page="/common/ui/addressUI.jsp"/>
                  <label id="consignee-add-msg"></label>
                </td>
              </tr>
              <tr>
                  <td><span class="required">*</span><label for="addressDetail">详细地址：</label></td>
                  <td>
                      <textarea name="addressDetail" id="addressDetail" maxlength="100" class="textarea w450"
                                data-rule="required;length[2~200];"></textarea>

                  </td>
              </tr>
              <tr>
                  <th><span class="required">*</span><label for="contactTel">联系电话：</label></th>
                  <td>
                      <input maxlength="20" type="text" name="contactTel" id="contactTel"
                             class="text" data-rule="required;length[8~20];">
                      <label id="contactTel-msg"></label>
                  </td>
              </tr>
              <tr class="tr-action">
                <th>&nbsp;</th>
                <td>
                  <div id="form-edit-button">
                    <input id="_submit" type="submit" class="button-action-ok" value="添加新地址">
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:;" class="button-action-cancel"><span>清&nbsp;&nbsp;空</span></a>
                    <label class="label-info" id="submit-add-msg"></label>
                  </div>
                </td>
              </tr>
              <input type="hidden" name="token" value="80b3780406ab1aa2f3ceedf74b8cf3ab"></tbody>
            </table>
          </div>
        </form>
      </div>
    </div>
    <form id="del-form" action="${ctx}/my/buyer/address/delete.htm" method="post" >
        <input type="hidden" id="delId" name="id" value="">
    </form>
	<!---->
	<div class="myRes-record">
            <div class="list-group-title" id="list-group-title">
                <table border="0" cellpadding="0" cellspacing="0">
                    <thead>
                    <tr>
                        <th class="col-pro" width="15%">收货人</th>
                        <th class="col-date-res"  width="40%">收货地址</th>
                        <th class="col-date-buy"  width="15%">联系电话</th>
                        <th class="col-operate" width="30%">操作</th>
                    </tr>
                    </thead>
                </table>
            </div>
            <div class="list-group" id="list-group">
                <div class="list-group-item">
                    <div class="o-pro">
                        <table border="0" cellpadding="0" cellspacing="0">
                            <tbody>
                            <c:forEach items="${list}" var="item">
                            <tr>
                                <td class="col-pro-info" width="15%">
                                    <p class="p-name">
                                        <a title="" href="##">${item.contactName}</a>
                                    </p>
                                </td>
                                <td class="col-date-res"  width="40%">
                                    ${myfn:address(item.addressProvinceId)}
                                    ${myfn:address(item.addressCityId)}
                                    ${myfn:address(item.addressAreaId)}
                                    ${item.addressDetail}
                                </td>
                                <td class="col-date-buy"  width="15%">
                                    ${item.contactTel}
                                </td>
                                <td class="col-operate"  width="30%">
                                    <p>
                                        <a href="javascript:void(0);" onclick="edit('${item.id}','${item.contactName}','${item.addressProvinceId}','${item.addressCityId}','${item.addressAreaId}','${item.addressDetail}','${item.contactTel}')" class="button-operate-remind"><span>编辑</span></a>
                                        <a href="javascript:void(0);" onclick="del('${item.id}')" class="button-operate-remind"><span>删除</span></a>
                                    </p>

                                </td>
                            </tr>
                            </c:forEach>
                            </tbody>
                        </table>
                    </div>
                </div>

            </div>
            <div class="list-group-page">
                <div class="pager" id="list-pager">
                </div>
            </div>
        </div>
	<!---->
  </div>
  <div class="fl u-1-5">
    <!--左边菜单 -->
    <%@include file="left.jsp" %>
  </div>
  <div class="hr-45"></div>


</div>
<!-- /主体 -->

<!-- 底部 -->
<%@include file="/common/footer.jsp" %>
<!-- /底部 -->

</body>
</html>
<script type="text/javascript">
function edit(id, contactName, province, city, area, addressDetail, contactTel){

    $("#id").val(id);
    $("#contactName").val(contactName);
    $("#addressDetail").val(addressDetail);
    $("#contactTel").val(contactTel);
    setArea(province, city, area);
    $("#_submit").val("确定");
    $("#address-form").attr("action", "${ctx}/my/buyer/address/update.htm");
}

function del(id){
    $("#delId").val(id);
    $("#del-form").submit();
}

</script>